<!DOCTYPE html> 
<html> 
<head> 
	<meta  charset="utf-8" />
	<title>标题</title>
	<meta name="viewport" content="width=device-width, initial-scale=1"> 
	<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
	<script src="__PUBLIC__/js/jquery-1.7.2.min.js"></script>
	<script src="__PUBLIC__/js/jquery.validate.js"></script>
	<!-- <script src="__PUBLIC__/js/jquery.metadata.js"></script> -->
    <script src="__PUBLIC__/js/messages_cn.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/Css/jquery.validate.css" />
	<link rel="stylesheet" href="__PUBLIC__/Css/jquery.mobile-1.2.0.css" />		
	<script src="__PUBLIC__/js/jquery.mobile-1.2.0.js"></script>
    <script type="text/javascript">
      $().ready(function() {
    	 $("#business").validate();  
    	});
    </script>
</head>
<body>
<div data-role="page"> 
　<div data-role="header" data-position="fixed">　<a href="__URL__/edit/id/{$good.bussinessid}" rel="external" data-role="button" data-icon="back">后退</a>
           <div style="text-align:center;" >修改商品</div>   
           <a href="#" data-role="button" data-icon="refresh">刷新</a></div> 
　 <div data-role="content">
  <form method="post" action="__URL__/goodsupdate" data-ajax="false" id="business" class="validate">
   <input type="hidden" name="userid" value="<?php echo $_SESSION[C('USER_AUTH_KEY')] ?>"/> 
   <input type="hidden" name="id" value="{$good.id}"/> 
    <input type="hidden" name="bid" value="{$good.bussinessid}"/>        
  <table align="center">	      
			<tr>
			<td><label>购买产品名称：</label></td>
			<td><select name="goodname" id="goodname" data-mini="true"
							class="required">
								<option value="">请选择</option>
								<volist name="goods" id="vo">
								<option <eq name="vo.goodsname" value="$good.goodname">selected="selected" </eq>>{$vo.goodsname}</option>
								
								</volist>
						</select></td>
			</tr>
			<tr>
			<td><label>产品价格：</label></td><td><input  id="price" name="price" value="{$good.price}" type="number"/></td>
			</tr>
			<tr>
			<td><label>购买数量：</label></td><td><input  name="quality" id="quality" value="{$good.quality}" type="number" onblur="setVal();" onkeydown="hideText();"/></td>
			</tr>
			<tr>
			<td><label>金额：</label></td><td><input  name="totalprice"  id="totalprice" value="{$good.totalprice}" type="number" onblur="setVal();" /></td>
			</tr>
			<tr>
			<td colspan="2">
			<div data-type="horizontal" data-role="controlgroup"  style="text-align:center;">
			<input type="submit" value="保存" data-icon="check"/>
			<a href="__URL__/edit/id/{$good.bussinessid}"  rel="external" data-icon="back" data-role="button" >取消</a>
			<script type="text/javascript">
			function setVal() {
				//var quality=document.getElementById('quality').value;
				var totalprice = document.getElementById('totalprice');
				var price = document.getElementById('price');
				var quality = document.getElementById('quality');
				//totalprice.value=quality*price;
				if(totalprice.value!=null&&totalprice.value!=""&&price.value!=null&&price.value!="")
				{
				  quality.value = totalprice.value / price.value;
				}
				else if(quality.value!=null&&quality.value!=""&&price.value!=null&&price.value!="")
				{
					totalprice.value=quality.value*price.value;
					
				}
			}
			function hideText()
			{
				document.getElementById('totalprice').value="";
			}
			</script>
			
			</div>

			</td>
			</tr>
</table>
</form>
</div> 
</div>
</body>
</html>